package com.xaicode.template.activemq.queue;

import org.apache.activemq.command.ActiveMQDestination;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;

public class CustomerQueue implements MessageListener {

    @Override
    public void onMessage(Message message) {
        try {
            ActiveMQDestination queues = (ActiveMQDestination) message.getJMSDestination();
            if (queues.getPhysicalName().equalsIgnoreCase("queue1")) {
                System.out.println(queues.getPhysicalName());
            } else if (queues.getPhysicalName().equalsIgnoreCase("queue2")) {
                System.out.println(queues.getPhysicalName());
            }
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
